#include<string.h>
#include<stdbool.h>

char *kthDistinct(char **arr, int arrSize, int k)
{
    bool vis[1005] = {0};
    int cnt;
    for (int i = 0; i < arrSize; i++)
    {
        cnt = 0;
        for (int j = 0; j < arrSize; j++)
        {
            if (i == j)
                continue;
            if (strcmp(arr[i], arr[j]) == 0)
            {
                cnt++;
                break;
            }
        }
        if (cnt == 0)
        {
            vis[i] = true;
        }
    }
    for (int i = 0; i < 1005; i++)
    {
        if (vis[i])
        {
            k--;
            if (k == 0)
                return arr[i];
        }
    }
    return "";
}
